package me.xhy.java.springboot3.r2dbc.s05one2one.s051entity;


import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.Column;
import org.springframework.data.relational.core.mapping.Table;

import java.time.Instant;

@Table("t_book")
public class S0512Book {
  /*表结构
  CREATE TABLE `t_book`  (
    `id` bigint(20) NOT NULL AUTO_INCREMENT,
    `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
    `author_id` bigint(20) NULL DEFAULT NULL,
    `publish_time` datetime(0) NULL DEFAULT NULL,
    PRIMARY KEY (`id`) USING BTREE
  ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
   */

  @Id
  private Long id;
  private String title;
  @Column("author_id")
  private Long authorId;
  @Column("publish_time")
  private Instant publishTime; // 使用 Instant 或者 LocalXxx

  @Override
  public String toString() {
    return "Book{" +
        "id=" + id +
        ", title='" + title + '\'' +
        ", authorId=" + authorId +
        ", publishTime=" + publishTime +
        '}';
  }

  public Long getId() {
    return id;
  }

  public void setId(Long id) {
    this.id = id;
  }

  public String getTitle() {
    return title;
  }

  public void setTitle(String title) {
    this.title = title;
  }

  public Long getAuthorId() {
    return authorId;
  }

  public void setAuthorId(Long authorId) {
    this.authorId = authorId;
  }

  public Instant getPublishTime() {
    return publishTime;
  }

  public void setPublishTime(Instant publishTime) {
    this.publishTime = publishTime;
  }
}
